package com.bolt.auth.admin.api.sys.dto;

import com.bolt.convention.data.BaseDTO;
import com.bolt.convention.validation.constraints.Mobile;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;

@Data
public class OrgDTO extends BaseDTO {

    private String id;

    @ApiModelProperty(notes = "名称")
    @NotBlank
    private String name;


    @ApiModelProperty(notes = "机构编号")
    private String code;


    @ApiModelProperty(notes = "区域编码")
    @NotBlank
    private String areaCode;


    @ApiModelProperty(notes = "联系地址")
    private String address;


    @ApiModelProperty(notes = "邮政编码")
    private String zipCode;


    @ApiModelProperty(notes = "父级节点")
    private String pid;


    @ApiModelProperty(notes = "负责人")
    private String master;

    @ApiModelProperty(notes = "电话")
    @Mobile
    private String tel;

    @ApiModelProperty(notes = "邮箱")
    private String email;

    @ApiModelProperty(notes = "备注信息")
    private String remarks;

    @ApiModelProperty(notes = "状态：1启用、0禁用")
    private Boolean enabled;

    @ApiModelProperty(notes = "地区名称")
    private String areaName;



    @ApiModelProperty(notes = "排序号")
    private Integer orderRank;

    private Integer childrenSize = 0;

    private Integer level;


    private Integer versionNO;

    public Boolean getHasChildren() {
        return childrenSize > 0;
    }

    public Boolean getLeaf() {
        return childrenSize==0;
    }

    public String getLabel() {
        return name;
    }

}